using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace FanDongping.Stock
{
    public class Stock
    {
        string id;
        string name, desc;
        bool modified = true;

        [XmlIgnore]
        public bool Modified
        {
            get { return modified; }
            set { modified = value; }
        }

        public Stock()
        {
        }

        public Stock(string id)
        {
            this.id = id;
        }

        [XmlAttribute]
        public string ID
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    modified = true;
                    id = value;
                }
            }
        }

        public string Name
        {
            get { return name; }
            set
            {
                if (name != value)
                {
                    modified = true;
                    name = value;
                }
            }
        }


        public string Desc
        {
            get { return desc; }
            set
            {
                if (desc != value)
                {
                    modified = true;
                    desc = value;
                }
            }
        }

        public string DisplayString
        {
            get
            {
                return string.Format("{0} {1}", id, name);
            }
        }

        public override string ToString()
        {
            return DisplayString;
        }


    }
}
